using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ICP_MS.Plugin.Tune;

public class FormAutoTuneNewRatio : Form
{
	private IContainer components = null;

	private Label label1;

	private Label label2;

	private ComboBox cbNumerator;

	private ComboBox cbDenominator;

	private Button btnOk;

	private Button btnCancel;

	public string Numerator { get; set; }

	public string Denominator { get; set; }

	public FormAutoTuneNewRatio(string[] symbols)
	{
		InitializeComponent();
		ComboBox.ObjectCollection items = cbNumerator.Items;
		object[] items2 = symbols;
		items.AddRange(items2);
		ComboBox.ObjectCollection items3 = cbDenominator.Items;
		items2 = symbols;
		items3.AddRange(items2);
	}

	private void btnOk_Click(object sender, EventArgs e)
	{
		if (cbNumerator.SelectedItem == null || cbDenominator.SelectedItem == null)
		{
			MessageBox.Show(Lang.Txt("FormAutoTuneNewRatio.MessageBox.Info1.Text"));
			return;
		}
		Numerator = cbNumerator.SelectedItem.ToString();
		Denominator = cbDenominator.SelectedItem.ToString();
		if (Numerator == Denominator)
		{
			MessageBox.Show(Lang.Txt("FormAutoTuneNewRatio.MessageBox.Info2.Text"));
		}
		else
		{
			base.DialogResult = DialogResult.OK;
		}
	}

	private void btnCancel_Click(object sender, EventArgs e)
	{
		base.DialogResult = DialogResult.Cancel;
	}

	private void FormAutoTuneNewRatio_Load(object sender, EventArgs e)
	{
		ApplyResources();
	}

	private void ApplyResources()
	{
		Text = Lang.Txt("FormAutoTuneNewRatio.Title.Text");
		label1.Text = Lang.Txt("FormAutoTuneNewRatio.Nominator.Text");
		label2.Text = Lang.Txt("FormAutoTuneNewRatio.Denominator.Text");
		btnCancel.Text = Lang.Txt("FormAutoTuneNewRatio.Button.Cancel.Text");
		btnOk.Text = Lang.Txt("FormAutoTuneNewRatio.Button.OK.Text");
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.label1 = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.cbNumerator = new System.Windows.Forms.ComboBox();
		this.cbDenominator = new System.Windows.Forms.ComboBox();
		this.btnOk = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		base.SuspendLayout();
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(54, 30);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(35, 12);
		this.label1.TabIndex = 0;
		this.label1.Text = "分子:";
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(54, 63);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(35, 12);
		this.label2.TabIndex = 1;
		this.label2.Text = "分母:";
		this.cbNumerator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cbNumerator.FormattingEnabled = true;
		this.cbNumerator.Location = new System.Drawing.Point(109, 27);
		this.cbNumerator.Name = "cbNumerator";
		this.cbNumerator.Size = new System.Drawing.Size(121, 20);
		this.cbNumerator.TabIndex = 2;
		this.cbDenominator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cbDenominator.FormattingEnabled = true;
		this.cbDenominator.Location = new System.Drawing.Point(109, 60);
		this.cbDenominator.Name = "cbDenominator";
		this.cbDenominator.Size = new System.Drawing.Size(121, 20);
		this.cbDenominator.TabIndex = 3;
		this.btnOk.Location = new System.Drawing.Point(65, 112);
		this.btnOk.Name = "btnOk";
		this.btnOk.Size = new System.Drawing.Size(75, 23);
		this.btnOk.TabIndex = 4;
		this.btnOk.Text = "确定";
		this.btnOk.UseVisualStyleBackColor = true;
		this.btnOk.Click += new System.EventHandler(btnOk_Click);
		this.btnCancel.Location = new System.Drawing.Point(168, 112);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(75, 23);
		this.btnCancel.TabIndex = 5;
		this.btnCancel.Text = "取消";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.btnCancel.Click += new System.EventHandler(btnCancel_Click);
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(287, 163);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.btnOk);
		base.Controls.Add(this.cbDenominator);
		base.Controls.Add(this.cbNumerator);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.label1);
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "FormAutoTuneNewRatio";
		base.ShowIcon = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "调谐比率编辑";
		base.Load += new System.EventHandler(FormAutoTuneNewRatio_Load);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
